home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
drdobbs
/
1991
/
03
/
asm_macr.asc
< prev
next >
Wrap
Text File
|
1991-02-15
|
6KB
|
251 lines
_ASSEMBLY LANGUAGE MACROS_
by Ken Skier
[LISTING ONE]
;--------------------------------------------;
; SkiSoft Macros ;
; ;
; Copyright (c) 1990 by SkiSoft, Inc. ;
; All rights reserved. ;
; ;
; ;
; Created by Ken Skier ;
; ;
; SkiSoft, Inc. ;
; 1644 Massachusetts Avenue, Suite 79 ;
; Lexington, MA 02173 ;
; Tel: (617) 863-1876 Fax: (617 861-0086 ;
; ;
;--------------------------------------------;
@ EQU OFFSET
JSR equ CALL
RTS equ RET
SEC equ STC
IF_ MACRO sub, dest
CALL sub
JC dest
ENDM
IF_NOT MACRO sub, dest
CALL sub
JNC dest
ENDM
RET_FALSE MACRO
CLC
RET
ENDM
RET_TRUE MACRO
STC
RET
ENDM
;---------------------------------------;
; ;
; 16-bit Register Compare macros ;
; ;
;---------------------------------------;
IF_AX MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 AX, exp, val, dest, last
ENDM
IF_BP MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 BP, exp, val, dest, last
ENDM
IF_BX MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 BX, exp, val, dest, last
ENDM
IF_CX MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 CX, exp, val, dest, last
ENDM
IF_DX MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 DX, exp, val, dest, last
ENDM
IF_SI MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 SI, exp, val, dest, last
ENDM
IF_SP MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 SP, exp, val, dest, last
ENDM
IF_DI MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG16 DI, exp, val, dest, last
ENDM
IF_REG16 MACRO reg, exp, val, dest, last
%POPLCTL ;; Restore source-level listing parameters.
IFIDNI <val>, <@>
CMP reg, @ dest
%PUSHLCTL
%NOLIST
IFITS_ exp, last
ELSE
CMP reg, word ptr val
%PUSHLCTL
%NOLIST
IFITS_ exp, dest
ENDIF
ENDM
;---------------------------------------;
; ;
; 8-bit Register Compare macros ;
; ;
;---------------------------------------;
IF_AL MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 AL, exp, val, dest, last
ENDM
IF_AH MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 AH, exp, val, dest, last
ENDM
IF_BL MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 BL, exp, val, dest, last
ENDM
IF_BH MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 BH, exp, val, dest, last
ENDM
IF_CL MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 CL, exp, val, dest, last
ENDM
IF_CH MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 CH, exp, val, dest, last
ENDM
IF_DL MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 DL, exp, val, dest, last
ENDM
IF_DH MACRO exp, val, dest, last
%PUSHLCTL
%NOLIST
IF_REG8 DH, exp, val, dest, last
ENDM
IF_REG8 MACRO reg, exp, val, dest, last
%POPLCTL ;; Restore source-level listing parameters.
IFIDNI <val>, <@>
CMP reg, @ dest
%PUSHLCTL
%NOLIST
IFITS_ exp, last
ELSE
CMP reg, byte ptr val
%PUSHLCTL
%NOLIST
IFITS_ exp, dest
ENDIF
ENDM
IFITS_ MACRO exp, dest
%POPLCTL ;; Restore source-level listing parameters.
IFIDNI <exp>, <{> ;; <
JB dest
elseIFIDNI <exp>, <=> ;; =
JE dest
elseIFIDNI <exp>, <}> ;; >
JA dest
elseIFIDNI <exp>, <{=> ;; <
JBE dest
elseIFIDNI <exp>, <{}> ;;
JNE dest
elseIFIDNI <exp>, <}=> ;; >=
JAE dest
ENDIF
ENDM
IFITS MACRO exp, dest
%PUSHLCTL
%LIST
IFIDNI <exp>, <{> ;; <
JB dest
elseIFIDNI <exp>, <=> ;; =
JE dest
elseIFIDNI <exp>, <}> ;; >
JA dest
elseIFIDNI <exp>, <{=> ;; <
JBE dest
elseIFIDNI <exp>, <{}> ;;
JNE dest
elseIFIDNI <exp>, <}=> ;; >=
JAE dest
ENDIF
%POPLCTL
ENDM
IF_ITS EQU IFITS
;--------------------------------------;
; ;
; End of SkiSoft macros. ;
; ;
;--------------------------------------;